import openpyxl

data = openpyxl.load_workbook('xlsx格式测试工作簿.xlsx')
# 取第一张表
sheetnames = data.sheetnames
table = data.active
nrows = table.max_row  # 获得行数
print(nrows)
ncolumns = 1
values = ['E', 'X', 'C', 'E', 'L']
for i in values:
    table.cell(nrows+1,ncolumns,i)
    ncolumns+=1


data.save('xlsx格式测试工作簿.xlsx')



def sjylink_hive_select(a):
    conn = hive.connect(host=os.environ['hive_ip'], port=int(os.environ['hive_port']), auth="LDAP",
                          database=os.environ['hive_database'], username=os.environ['hive_username'],
                          password=os.environ['hive_password'])
    cur=conn.cursor()
    cur.execute('select `'+a+'` from '+ os.environ['ty_fqmc_en']+'.standard_hive')
    data = cur.fetchall()
    print(data[0][0])
    print('---------------hive-------------------------')
    cur.close()
    conn.close()
    return data[0][0]

